//
//  DFRowCommand.m
//  dfutil
//
//  Created by Tom Booth on 25/06/2009.
//  Copyright 2009 __MyCompanyName__. All rights reserved.
//

#import "DFRowCommand.h"


@implementation DFRowCommand

@synthesize typeMoniker;

- initWithXML:(NSXMLElement*) xml {
	self = [super initWithXML:xml];
	
	rowParameters = [[NSMutableArray alloc] init];
	
	//NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
	
	// fill with row command specific stuff
	// get the row structure if there is one
	if ([[xml nodesForXPath:[NSString stringWithFormat:@"%@%@",[xml XPath],@"//responseline"] error:NULL] count] > 0) {
		NSArray *params = [xml nodesForXPath:[NSString stringWithFormat:@"%@%@",[xml XPath],@"//responseline//value"] error:NULL];
		for (NSXMLElement *parameter in params) {
			[rowParameters addObject:[[DFParameter alloc] initWithXML:parameter]];
		}
		
		typeMoniker = [DFTypePool generateTypeForParameters:rowParameters];
		fprintf(stdout, "%s", [typeMoniker cString]);
	}
	
	//[pool drain];
	
	return self;
}

@end
